package com.wsq.servicewindow;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    View view;
    WindowManager windowManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
//        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
//        layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
//        layoutParams.width = 200;
//        layoutParams.height = 200;

        Button button = new Button(getApplicationContext());
        button.setText("nihao");

        Intent intent = new Intent();
        intent.setPackage(this.getPackageName());
        intent.setAction("com.wsq.dialog.SERVICE");
        startService(intent);

        Log.e("rk", Build.FINGERPRINT);
        Log.e("rk", Build.DEVICE);

//        view = LayoutInflater.from(this).inflate(R.layout.see_screen_dialog, null, false);
//        windowManager.addView(button, layoutParams);
//        showDialog();

    }

    private void creatWindow(){

    }



    @Override
    protected void onDestroy() {
        super.onDestroy();
//        Intent intent = new Intent();
//        intent.setPackage(this.getPackageName());
//        intent.setAction("com.wsq.dialog.SERVICE");
//        stopService(intent);
//        windowManager.removeView(view);
//        view = null;
    }
}
